package com.twu.biblioteca;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: Shreyansh
 * Date: 11/8/13
 * Time: 4:16 PM
 * To change this template use File | Settings | File Templates.
 */
public class BookList {
    ArrayList<Book> bookList;
    int[] quantityOfBook=new int[4];
    public BookList()
    {
        bookList =new ArrayList<Book>();
        Book book=new Book("Fountainhead");
        bookList.add(book);
        book=new Book("Santaram");
        bookList.add(book);
        book=new Book("White Tiger");
        bookList.add(book);
        book=new Book("World Without End");
        bookList.add(book);
        quantityOfBook[0]=5;
        quantityOfBook[1]=0;
        quantityOfBook[2]=5;
        quantityOfBook[3]=0;
    }
    public ArrayList<Book> getBookList() {
        return bookList;
    }
    public void viewListOfBooks() {
        System.out.println("Name");
        for(Book book:this.getBookList())
        {
            System.out.println(book.bookname);
        }
    }
    public void viewAvailableBooks() {
        System.out.println("Name");
        int indexOfBook=0;

        for(Book book:this.getBookList())
        {
            if(quantityOfBook[indexOfBook]!=0)
            {
                System.out.println(book.bookname);

            }
            indexOfBook++;
        }
    }
}
